package 力扣日常刷题.木22一月.第07天0115;

import 力扣日常刷题.ListNode;

/**
 * @author 帅小伙
 * @date 2022/1/15
 * @description
 */
public class Demo03中等链表最大孪生和 {


    int ans = 0;
    public int pairSum(ListNode head) {
        ListNode t = head;
        int[]arr = new int[100010];
        int size = 0;
        while(head!=null){
            arr[size++] = head.val;
            head = head.next;
        }
        for (int i = 0; i < size/2; i++) {
            ans = Math.max(ans,(arr[i]+arr[size-i-1]));
        }
        return ans;
    }
}
